/* tslint:disable */
/* eslint-disable */
/**
 * Admin.NET 通用权限开发平台
 * 让 .NET 开发更简单、更通用、更流行。整合最新技术，模块插件式开发，前后端分离，开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动！任何基于本项目二次开发而产生的一切法律纠纷和责任，我们不承担任何责任！</font></b></u>
 *
 * OpenAPI spec version: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios';
import { Configuration } from '../configuration';
import { WarehousePositionPageInput } from '../models/warehouse-postion-page-input';
import { ResultWarehousePosition } from '../models/result-pagelist-warehouseposition';
import { DeleteWarehousePositionInput, WarehousePosition } from '../models/warehouse-position-input';

const BaseUrl=(window as any).__env__.VITE_API_URL
import { axiosInstance } from '/@/utils/axios-utils' 
import { serveConfig } from '../../utils/axios-utils';
//import { stringify } from 'query-string';


// Some imports not used depending on template conditions
// @ts-ignore


/**
 * SysWechatUserApi - axios parameter creator
 * @exports
 */
export const WarehousePositionApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 获取库位档案
         * @summary 获取库位档案
         * @param {WarehousePositionPageInput} [body] 库位档案
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        apiWarehousePositionPageGet: async (body?: WarehousePositionPageInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/warehouseInfomation/GetWarehousePositPagelist`;
            const localVarUrlObj = new URL(localVarPath, 'https://example.com');
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions: AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options };
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;
           

    // 若 body 存在，将其转换为 JSON 字符串并添加到 URL 的查询参数中拼接参数
    // if (body) {
    // const queryString = Object.entries(body)
    //     .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value))}`)
    //     .join('&');
    // }
// 假设后端只接受一个 string 类型参数，将 body 中的所有属性序列化为一个字符串
// 这里简单将 body 序列化为 JSON 字符串作为参数值，参数名为 data
if (body) {
    const data = JSON.stringify(body);
    localVarUrlObj.search = `data=${encodeURIComponent(data)}`;
}

            // 添加认证
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? await configuration.accessToken()
                    : await configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
            }

            const query = new URLSearchParams(localVarUrlObj.search);
            for (const key in localVarQueryParameter) {
                query.set(key, localVarQueryParameter[key]);
            }
            for (const key in options.params) {
                query.set(key, options.params[key]);
            }
            localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';

            localVarUrlObj.search = (new URLSearchParams(query)).toString();
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
                options: localVarRequestOptions,
            };
        },

        /**
         * 增加库位档案
        */
        apiWarehousePositionAddPost: async (body?: WarehousePosition, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/warehouseInfomation/InsertWarehousePosit`;
            const localVarUrlObj = new URL(localVarPath, serveConfig.basePath);



            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions: AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options };
            const localVarHeaderParameter = {} as any;
            // 添加认证
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? await configuration.accessToken()
                    : await configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
            localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers };
            localVarRequestOptions.data = JSON.stringify(body || {});
            return {
                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
                options: localVarRequestOptions,
            };

        },

        /**
         * 修改库位档案
         */
        apiWarehousePositionUpdatePost: async (body?: WarehousePosition, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/warehouseInfomation/UpdateWarehousePosit`;
            const localVarUrlObj = new URL(localVarPath, serveConfig.basePath);


            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            };
            const localVarRequestOptions: AxiosRequestConfig = { method: 'PUT', ...baseOptions, ...options };
            const localVarHeaderParameter = {} as any;
            // 添加认证
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? await configuration.accessToken()
                    : await configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;

            }
            localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
            localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers };
            localVarRequestOptions.data = JSON.stringify(body || {});
            return {
                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
                options: localVarRequestOptions,
            };

        },

        /**
         * 删除库位档案
         */
        apiWarehousePositionDeletePost: async (body?: DeleteWarehousePositionInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/api/warehouseInfomation/DeletePosition`;
            const localVarUrlObj = new URL(localVarPath, serveConfig.basePath);


            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            };
            const localVarRequestOptions: AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options };
            const localVarHeaderParameter = {} as any;
            // 添加认证
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? await configuration.accessToken()
                    : await configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;


            };
            localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
            localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers };
            localVarRequestOptions.data = JSON.stringify(body || {});
            return {
                url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
                options: localVarRequestOptions,
            };


        },
    };
}
/**
 * 
 * @param configuration 
 * @returns 
 */
export const apiWarehousePositionApiFp = function (configuration?: Configuration) {
    return {
        /**
         * 获取库位档案
         */
        async apiWarehousePositionPageGet(
            body?: WarehousePositionPageInput,
            options?: AxiosRequestConfig
        ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ResultWarehousePosition>>> {
            const localVarAxiosArgs = await WarehousePositionApiAxiosParamCreator(configuration).apiWarehousePositionPageGet(body, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs: AxiosRequestConfig = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
                return axios.request(axiosRequestArgs);
            };
        },

        /**
         * 增加库位档案
         */
        async apiWarehousePositionAddPost(
            body?: WarehousePosition,
            options?: AxiosRequestConfig
        ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
            const localVarAxiosArgs = await WarehousePositionApiAxiosParamCreator(configuration).apiWarehousePositionAddPost(body, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs: AxiosRequestConfig = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
                return axios.request(axiosRequestArgs);
            };
        },

        /**
         * 修改库位档案
         */        async apiWarehousePositionUpdatePost(
            body?: WarehousePosition,
            options?: AxiosRequestConfig
        ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
            const localVarAxiosArgs = await WarehousePositionApiAxiosParamCreator(configuration).apiWarehousePositionUpdatePost(body, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs: AxiosRequestConfig = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
                return axios.request(axiosRequestArgs);
            };
        },

        /**
         * 删除库位档案
         * 
         * 
         */        async apiWarehousePositionDeletePost(
            id?: DeleteWarehousePositionInput,
            options?: AxiosRequestConfig
        ): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
            const localVarAxiosArgs = await WarehousePositionApiAxiosParamCreator(configuration).apiWarehousePositionDeletePost(id, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs: AxiosRequestConfig = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url };
                return axios.request(axiosRequestArgs);
            };
        },


        // ... existing code ...



    };
};
/**
 * WarehouseApi - object-oriented interface
 * @export
 * @class WarehouseApi
 * @extends {BaseAPI}
 */
export class WarehousePositionApi extends BaseAPI {
    /**
     * 
     * @summary 获取库位档案
     * @param {WarehousePositionPageInput} [body] 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WarehouseApi
     */
    public async apiWarehousePositionPageGet(body?: WarehousePositionPageInput, options?: AxiosRequestConfig): Promise<AxiosResponse<ResultWarehousePosition>> {
        return apiWarehousePositionApiFp(this.configuration).apiWarehousePositionPageGet(body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary 增加库位档案
     * @param {WarehousePosition} [body] 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WarehouseApi
     */
    public async apiWarehousePositionAddPost(body?: WarehousePosition, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
        return apiWarehousePositionApiFp(this.configuration).apiWarehousePositionAddPost(body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary 修改库位档案
     * @param {WarehousePosition} [body] 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WarehouseApi
     */
    public async apiWarehousePositionUpdatePost(body?: WarehousePosition, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
        return apiWarehousePositionApiFp(this.configuration).apiWarehousePositionUpdatePost(body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary 删除库位档案
     * @param {DeleteWarehousePositionInput} [body] 
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WarehouseApi
     */
    public async apiWarehousePositionDeletePost(body?: DeleteWarehousePositionInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
        return apiWarehousePositionApiFp(this.configuration).apiWarehousePositionDeletePost(body, options).then((request) => request(this.axios, this.basePath));
    }
}

interface ResponseDate<T=any>{
  code:string,
  message:string,
  result:T
}
/** 
 * 导出
 * @param data 导出条件
 * @param responseType 返回类型
 * @returns 导出文件
 */
export function WarehousePositionexportApi(data:any)
{
// 根据调用方式修改请求配置，添加 responseType 为 'blob'
return axiosInstance<Blob>({
  responseType: 'blob',
    url: BaseUrl+'/api/warehouseinfomation/WarehousePositExport',
    method: 'POST',
    data
  })
}

/** 
 * 导入文件操作
 * @param file 导入的文件对象
 * @returns 导入文件操作的响应结果
 */
    export function WarehousePositioninportApi(formData:any) {
    return axiosInstance<ResponseDate>({
      responseType: 'blob',
      url: BaseUrl + '/api/warehouseInfomation/ImportWarehousePosit',
      method: 'POST',
      data: formData
    });
  }

/** 
 * 下载接口
 * @param data 下载所需参数
 * @returns 下载文件的响应
 */
export function DownloadWarehousePositionApi(params?: Record<string, any>)  {
  return axiosInstance<Blob>({
    responseType: 'blob',
    url: BaseUrl + '/api/warehouseInfomation/DownloadWarehousePosit',
    method: 'GET',
    params
  });
}

/**
 * 批量删除库位信息
 */
export function BatchDeletePositionApi(data: any[]) {
    return axiosInstance<ResponseDate>({

        url: BaseUrl + '/api/warehouseInfomation/BatchDeletePosition',
        method: 'Delete',
        data
    })
}